﻿@model Inscriptionem.Areas.Inscriptionem.Models.Views.TagViewModel

@{
    ViewBag.Title = "Inscriptionem » Tags » Edit Tag";
    Layout = "../Shared/Layout.cshtml";

    ViewBag.CurrentPage = "Tags";

    string message = string.Empty;

    switch (Model.Error)
    {
        case Inscriptionem.Areas.Inscriptionem.Models.Enums.TagError.TagEmpty:
        {
            message = "Please enter Tag.";
            break;
        }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.TagError.TagLanguageEmpty:
        {
            message = "Please enter Language.";
            break;
        }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.TagError.TagAlreadyExists:
        {
            message = "Tag already exists, try another one.";
            break;
        }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.TagError.Other:
        {
            message = "Unknown error occurred, please try again.";
            break;
        }
    }

    var language = Model.Languages.First(l => l.ID == Model.Language);
}

<div class="outer" id="contentwrap">
    @{Html.RenderPartial("NavigationMenu");}
    <div class="postcont">
		<div id="content">
            <div class="post type-post status-publish format-standard hentry">
                <h2 class="title">Edit Tag</h2>
                <div class="postdate-single error-message">@message</div>
                <hr />
                <form method="post" action="/Inscriptionem/Tag/Edit">
				    <div class="entry">
                        <input type="hidden" name="ID" value="@Model.ID" />
                        <p>Name <input type="text" name="Name" value="@Model.Name" /></p>
                        <input type="hidden" name="Language" value="@Model.Language" />
                        <p>Language <input type="text" name="LanguageName" value="@language.Name / @language.LocalizedName" disabled /></p>
	                </div>

                    <input type="reset" value="Reset" />&nbsp;|&nbsp;<input type="submit" value="Edit" />
                </form>
			</div>
        </div>
	</div>	
</div>
